package com.great.service.impl;

import com.github.pagehelper.PageHelper;
import com.great.dao.ProductDao;
import com.great.domain.Product;
import com.great.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductDao productDao;


    @Override
    public List<Product> findAllProduct(int page, int size) {
        PageHelper.startPage(page, size);
        return productDao.findAllProduct();
    }

    @Override
    public void addproduct(Product product) {
        productDao.addproduct(product);
    }

    @Override
    public Product findproductById(Integer product_id) {
        return productDao.findproductById(product_id);
    }

    @Override
    public void productchange(Product product) {
        productDao.productchange(product);
    }

    @Override
    public void shangjia(Integer product_id) {
        productDao.shangjia(product_id);
    }

    @Override
    public void xiajia(Integer product_id) {
        productDao.xiajia(product_id);
    }

    @Override
    public List<Product> findcheProduct(int page, int size,Product product, String qrysearch) {
        PageHelper.startPage(page,size);
        return productDao.findcheProduct(product,qrysearch);
    }
}
